package com.ruslan.magaz.web;

import java.io.IOException;
import java.util.HashSet;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ruslan.magaz.Role1;

@Controller
public class RoleController {
	private RoleDao mDao;
	
	@Autowired
	public RoleController(RoleDao mDao) {
		this.mDao = mDao;
	}
	
	@RequestMapping(value="/addRole")
	public @ResponseBody
	void logIn(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{
		
		Role1 role = new Role1(3, "champ");
		mDao.addRole(role);
		(res).setStatus(200);
	}
}
